package window.tab;

import window.panel.OrderPanel;

import javax.swing.*;
import java.awt.*;

public class MyTab extends JPanel {
    private JScrollPane scrollPane;
    public MyTab() {
        this.setLayout(new BorderLayout());


        OrderPanel orderPanel = new OrderPanel();
        JPanel topPanel = new JPanel();
        topPanel.setLayout(new BorderLayout());
        JLabel label = new JLabel("Orders");
        label.setPreferredSize(new Dimension(100, 30));
        topPanel.add(label, BorderLayout.WEST);
        JButton refreshButton = new JButton("Refresh");
        refreshButton.addActionListener(e -> {
            orderPanel.loadOrders();
        });
        topPanel.add(refreshButton, BorderLayout.EAST);
        this.add(topPanel,BorderLayout.NORTH);
        scrollPane = new JScrollPane(orderPanel);
        this.add(scrollPane, BorderLayout.CENTER);
    }


    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setSize(600, 400);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(new MyTab());
        frame.setVisible(true);
    }
}
